
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@page pageEncoding="UTF-8" %>
<%@page isELIgnored="false" %>.
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>emplist</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/view/css/style.css" />
    <style type="text/css">
        #d1 a{ font-size: 120% ; margin-right:5px ; color:blue }
    </style>
</head>
<body>
<div id="wrap">
    <div id="top_content">
        <div id="header">
            <div id="rightheader">
                <p>
                    2009/11/20
                    <br />
                </p>
            </div>
            <div id="topheader">
                <h1 id="title">
                    <a href="#">main</a>
                </h1>
            </div>
            <div id="navigation">
            </div>
        </div>
        <div id="content">
            <p id="whereami">
            </p>
            <h1>
                Welcome!${sessionScope.username}
            </h1>
            <h1 style="text-align: right">
               <a href="${pageContext.request.contextPath}/euser/exit">安全退出</a>
            </h1>
            <form action="${pageContext.request.contextPath}/emp/delEmps" method="get">
            <table class="table">
                <tr class="table_header">
                    <td><input type="checkbox" id="dea" onclick="aaa()" /></td>
                    <td>
                        ID
                    </td>
                    <td>
                        Name
                    </td>
                    <td>
                        Salary
                    </td>
                    <td>
                        Age
                    </td>
                    <td>
                       部门名称
                    </td>
                    <td>
                        城市
                    </td>
                    <td>
                        删除
                    </td>
                    <td>
                        修改
                    </td>
                </tr>
                   <c:forEach var="emp" items="${requestScope.list}" varStatus="vs">
                      <c:if test="${vs.count%2==1}"><tr class="row1"></c:if>
                      <c:if test="${vs.count%2==0}"><tr class="row1"></c:if>
                <td><input type="checkbox" name="list" value="${emp.id}"/></td>
                         <td>${emp.id}</td>
                         <td>${emp.name}</td>
                         <td>${emp.salary}</td>
                         <td>${emp.age}</td>
                         <td>${emp.dept.name}</td>
                        <td>${emp.dept.city}</td>
<%--                        <td><a href="${pageContext.request.contextPath}/DelAction?tid=${emp.id}">删除</a> </td>--%>
<%--                <td><a href="${pageContext.request.contextPath}/QueryAction?id1=${emp.id}">修改</a></td>--%>
<%--                <td onclick="de(${emp.id})"><a href=""> 删除</a></td>--%>
                <td><input type="button" value="删除" onclick="de(${emp.id})"></td>
               <td><input type="button" value="修改" onclick="up(${emp.id})"></td>
                   </c:forEach>
                </form>
            <input type="submit"value="批量删除"/>
            </table>
            <div id="d1">
            <c:forEach var="i" begin="1" end="${requestScope.totalPage}">
                <c:if test="${param.page==i}">
                   <a style="color: #7BB425" href="${pageContext.request.contextPath}/emp/ShowAllEmp?pageNo=${i}">${i}</a>
                </c:if>
                <c:if test="${param.page!=i}">
                    <a  href="${pageContext.request.contextPath}/emp/ShowAllEmp?pageNo=${i}">${i}</a>
                </c:if>

            </c:forEach>
            </div>
            <p>
                <input type="button" class="button" value="Add Employee" onclick="location='${pageContext.request.contextPath}/view/addEmp.jsp'"/>
            </p>
        </div>
    </div>
    <div id="footer">
        <div id="footer_bg">
            ABC@126.com
        </div>
    </div>
</div>
<div>

</div>

<script type="text/javascript">

    function aaa() {

        var dea = document.getElementById("dea");
        if (dea.checked == true) {
            var tags = document.getElementsByTagName("input");
            for (var i = 0; i < tags.length; i++) {
                if (tags[i].type == "checkbox") {
                    tags[i].checked = true;
                }
            }
        }
        if (dea.checked == false) {
            var tags = document.getElementsByTagName("input");
            for (var i = 0; i < tags.length; i++) {
                if (tags[i].type == "checkbox") {
                    tags[i].checked = false;
                }
            }
        }
    }





    function  de(id) {
            var ba = window.confirm("确定删除id为"+id+"的用户吗?");
            if(ba == true){
                location.href = "${pageContext.request.contextPath}/emp/delEmp?id="+id;
            }else {
                alert("逗我玩呢!!!🤬🤬🤬🤬🤬🤬🤬🤬🤬");
            }
        }


        function up(id1) {
            var be = window.confirm("确定修改id为"+id1+"的用户吗?");
            if (be == true){
                <%--location.href = "${pageContext.request.contextPath}/QueryAction?id1="+id1;--%>
                location.href = "${pageContext.request.contextPath}/emp/queryEmp?id="+id1;
            }else {
                alert("逗我玩呢！！！🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯");
            }
        }


    
    
    
    
</script>



</body>
</html>
